{	Problem: http://codeforces.ru/problemset/problem/56/A
	Verdict: Accepted

}
const drink:array[1..11] of string = ('ABSINTH', 'BEER', 'BRANDY', 'CHAMPAGNE', 'GIN', 'RUM', 'SAKE', 'TEQUILA', 'VODKA', 'WHISKEY', 'WINE');
var i,n,a,k,count,j:integer; s:string;
begin
readln(n);
count:=0;
for i:=1 to n do begin
  readln(s);
  val(s,a,k);
  if (k=0) and (a<18) then inc(count) else
  for j:=1 to 11 do if drink[j]=s then inc(count);
end;
writeln(count);
readln;
end.